


import { BrowserRouter as History, HashRouter as Hash, Route, Switch, Redirect } from "react-router-dom"
import React, { Suspense, lazy } from 'react'
import Loading from "../components/loading"

export default function MainView() {
    return (
        <div style={{width:'100%'}}>
            <Hash>
                <Route component={MainRouter} />
            </Hash>
        </div>
    )
}


function MainRouter() {
    return (
        <div style={{width:'100%', minHeight: '100%'}}>
            <Suspense fallback={Loading()}>
                <Switch>
                    <Route path="/" exact render={() => (<Redirect to="/login" />)} />
                    <Route path="/404" component={lazy(() => import('./errorpages/404'))} />
                    <Route path="/503" component={lazy(() => import('./errorpages/503'))} />
                    <Route path="/login" component={lazy(() => import('./logins/login'))} />
                    <Route path="/register" component={lazy(() => import('./logins/register'))} />
                    <Route path="/forgetpass" component={lazy(() => import('./logins/forgetpass'))} />
                    <Route path="/main" component={lazy(() => import('./main'))} />
                    <Route render={() => (<Redirect to="/404" />)} />
                </Switch>
            </Suspense>
        </div>
    )
}